package com.cwm.test.factory.abstractfactory;

import java.lang.reflect.InvocationTargetException;

public abstract class AbstractFactory {

    public Object newInstance(Class  classz){
        Object obj = null;
        try {
            obj =  classz.getDeclaredConstructor().newInstance();
        } catch (InstantiationException e) {
            e.printStackTrace();
        } catch (IllegalAccessException e) {
            e.printStackTrace();
        } catch (InvocationTargetException e) {
            e.printStackTrace();
        } catch (NoSuchMethodException e) {
            e.printStackTrace();
        }finally {
            return obj;
        }
    }

    /**
     * 生产衣服
     *
     * @return
     */
    public abstract Clothes produceClothes();

    /**
     * 生产食品
     *
     * @return
     */
    public abstract Food produceFood();

}